<link rel="stylesheet" type="text/css" href="<?php echo $this->webroot . '/theme/default/u22'; ?>/css/stats.css"/>
<script>
    var url = 0;
    $(document).ready(function(){
        change_menu_class('m_2');
        <?php if($id):?>
        $("#item_<?php echo $id;?>").attr('checked', 'checked');
            url = <?php echo $id;?>;
        <?php endif;?>
        //alert(11);
        show_select();
    });

    function select_go() {
        var url = '<?php echo url_for('user/show/uhash/');?>';
        var s   = $("#check_uhash option:selected").attr('lable');
        var i   = $("#check_uhash option:selected").val();
        location.href   = url + s+"/id/"+i+'/';
    }
    function show_select() {
        var str = '';
        var id = $("item_"+url).attr('lable');
        $.ajax({
            url:"<?php echo url_for('servlet/my_url_list');?>",
            dataType:"json",
            success:function(data){
                //str = "<option id='item_0'>请选择</option>";
                $.each(data.data, function(k,v){
                    str +="<option value='"+v.id+"' id=item_"+v.id+" lable="+v.uhash+">"+v.title+"</option>";
                });
                $("#check_uhash").append(str);
                if(url !=0 && url !='') {
                    setTimeout(function() {
                       $("#item_"+url).attr('selected', true);
                    }, 1);

                }
            }
        });
    }
</script>
<div class="content">
    <?php echo get_block('user', 'left');?>
    <div class="info">
        <h3>详细信息统计-请选择短网址</h3>
        <p>短网址:<select id="check_uhash" onchange="select_go();">
                <option lable="0" id="item_0" value="0">请选择</option>
            </select>
        </p>
    </div>

    <div class="info">
        <h3>基本统计信息</h3>
        <div id="show_count">
                    <table style="width:100%;font-size: 12px;text-align: center;" id="visit_details" summary="visit details" >
            <thead>
                <tr>
                    <th>IP</th>
                    <th>手机访问</th>
                    <th>来访时间</th>
                    <th>来路</th>
                    <th>操作系统</th>
                    <th>浏览器</th>
                </tr>
            </thead>
            <tbody>
                <?php if(!empty($rs)):?>
                <?php foreach($rs as $k => $v):?>
                <tr>
                    <td><?php echo $v->getIp();?></td>
                    <td><?php if($v->getIsWap()){ e('是'); }else{ e('否');}?></td>
                    <td><?php e(date("h:i:s",$v->getCreated()))?></td>
                    <td>
                        <?php if($v->getHost()=='直接输入'):?>
                            直接输入
                        <?php else:?>
                        <a title="点击查看最后来路" target="_blank" href="<?php echo $v->getReferer();?>"><?php echo $v->getHost();?></a>
                        <?php endif;?>
                    </td>
                    <td><?php echo getOsName($v->getAgent());?></td>
                    <td><?php echo getIeName($v->getAgent());?></td>
                </tr>
                <?php endforeach;?>
                <?php endif;?>
            </tbody>
        </table>
        </div>
    </div>
</div>